<?php
require("./include/fpdf/fpdf.php");
include "_fpdf_mc_table.php";

$header  = array('BIL'
				,'NO_AHLI'
				,'NAMA_AHLI'
				,'NOKP_BARU'
				,'NOKP_LAMA'
				//,'BANGSA'
				,'KEAHLIAN'
				,'CAWANGAN'
				,'ALAMAT'
				,'TEL_PEJABAT'
				);
$w = array(10,12,50,25,20,15,30,90,20);
//$w = array(10,12,50,15,20,20,15,30,50,20);

//Instanciation of inherited class
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage('L');
$pdf->SetFont('Times','',9);
$pdf->SetWidths($w);

// Set the fields from DB == table header ....
$fields = $header;
/// NoAhli|Nama|NoKPBaru|NoKPLama|Bangsa|Status|Cawangan|Telefon|TelPejabat|
$i=0;
$pdf->SetFillColor(224,235,255);
$pdf->SetTextColor(0);
//$pdf->SetFont('Arial');

// fetch all data into array ...
$fill = true;
while($d = $res->FetchNextObject()){
$i++;
	$x = 0;
	$data = array();
	$data[] = $i;
	for($z=1; $z<count($fields); $z++){
		$data[] = $d->$fields[$z];
	}
	$pdf->row($data, $fill);
	$fill=!$fill;
}

$pdf->Output();
?>